package net.lengwang.iot.middleware.main;

import net.lengwang.iot.middleware.network.NetworkListener;
import net.lengwang.iot.middleware.network.CommonService;
import net.lengwang.iot.middleware.network.DefaultPacketHandler;

public class Application {
    public static void main(String[] args) {
        System.out.println("正在启动 IoT 中间件应用...");
        
        int port = 11030; // 或者从配置文件中读取
        
        NetworkListener networkListener = new NetworkListener(port);
        CommonService handCommonService = new CommonService(networkListener);
        DefaultPacketHandler packetHandler = new DefaultPacketHandler(handCommonService);
        
        networkListener.setPacketHandler(packetHandler);
        networkListener.setHandCommonService(handCommonService);
        
        System.out.println("开始监听端口 " + port);
        networkListener.start();
    }
}
